﻿using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Common;
using HumanManagement.BusinessObjects;
using HumanManagement.DataAccess;

namespace HumanManagement.BusinessLogic
{
	public class LeaderPositionBL
	{

		#region ***** Init Methods ***** 
		LeaderPositionDA objLeaderPositionDA;
		public LeaderPositionBL()
		{
			objLeaderPositionDA = new LeaderPositionDA();
		}
		#endregion

		#region ***** Get Methods ***** 
		/// <summary>
		/// Get LeaderPosition by id
		/// </summary>
		/// <param name="id">ID</param>
		/// <returns>LeaderPosition</returns>
		public LeaderPosition GetByID(int id)
		{
			return objLeaderPositionDA.GetByID(id);
		}

		/// <summary>
		/// Get all of LeaderPosition
		/// </summary>
		/// <returns>List<<LeaderPosition>></returns>
		public List<LeaderPosition> GetList()
		{
			string cacheName = "lstLeaderPosition";
			if( ServerCache.Get(cacheName) == null )
			{
				ServerCache.Insert(cacheName, objLeaderPositionDA.GetList(), "LeaderPosition");
			}
			return (List<LeaderPosition>) ServerCache.Get(cacheName);
		}

		/// <summary>
		/// Get DataSet of LeaderPosition
		/// </summary>
		/// <returns>DataSet</returns>
		public DataSet GetDataSet()
		{
			string cacheName = "dsLeaderPosition";
			if( ServerCache.Get(cacheName) == null )
			{
				ServerCache.Insert(cacheName, objLeaderPositionDA.GetDataSet(), "LeaderPosition");
			}
			return (DataSet) ServerCache.Get(cacheName);
		}


		/// <summary>
		/// Get all of LeaderPosition paged
		/// </summary>
		/// <param name="recperpage">recperpage</param>
		/// <param name="pageindex">pageindex</param>
		/// <returns>List<<LeaderPosition>></returns>
		public List<LeaderPosition> GetListPaged(int recperpage, int pageindex)
		{
			return objLeaderPositionDA.GetListPaged(recperpage, pageindex);
		}

		/// <summary>
		/// Get DataSet of LeaderPosition paged
		/// </summary>
		/// <param name="recperpage">recperpage</param>
		/// <param name="pageindex">pageindex</param>
		/// <returns>DataSet</returns>
		public DataSet GetDataSetPaged(int recperpage, int pageindex)
		{
			return objLeaderPositionDA.GetDataSetPaged(recperpage, pageindex);
		}





		#endregion

		#region ***** Add Update Delete Methods ***** 
		/// <summary>
		/// Add a new LeaderPosition within LeaderPosition database table
		/// </summary>
		/// <param name="obj_leaderposition">LeaderPosition</param>
		/// <returns>key of table</returns>
		public int Add(LeaderPosition obj_leaderposition)
		{
			ServerCache.Remove("LeaderPosition", true);
			return objLeaderPositionDA.Add(obj_leaderposition);
		}

		/// <summary>
		/// updates the specified LeaderPosition
		/// </summary>
		/// <param name="obj_leaderposition">LeaderPosition</param>
		/// <returns></returns>
		public void Update(LeaderPosition obj_leaderposition)
		{
			ServerCache.Remove("LeaderPosition", true);
			objLeaderPositionDA.Update(obj_leaderposition);
		}

		/// <summary>
		/// Delete the specified LeaderPosition
		/// </summary>
		/// <param name="id">ID</param>
		/// <returns></returns>
		public void Delete(int id)
		{
			ServerCache.Remove("LeaderPosition", true);
			objLeaderPositionDA.Delete(id);
		}
		#endregion
	}
}
